<?php

namespace Action\Flow\GenericFlow\Comment;

class Delete extends \Library\Action\UserAction
	implements \Library\Action\AjaxAction {

	private $_comment;

	public function execute() {
		parent::execute();
		
		$comment_id = $this->getParam( 'id' );
		$this->_comment = \Bean\Flow\GenericFlow\Comment::get( $comment_id );

		_a( $this->_comment->isDeletable(), 'You can\'t delete this comment' );

		$this->_comment->delete();

		return true;
	}
}
